import { get_unreviewed } from "@/api/audits.js";
import { useAppStore } from "@/stores/app";

/**
 * 获取未审核数量
 * @param {Object} param 请求参数
 * @param {string} param.project_table 项目表名 public_toilets garbage_stations recyclable_sites sanitation_rooms parking_lots
 * @param {string} param.type 类型 0未审核 1已完成审核
 * @returns {Promise<number>} 未审核数量
 */
export const getUnreadCount = (param) => {
  const appStore = useAppStore();
  get_unreviewed(param).then((res) => {
    if (res.code == 0) {
      appStore.setUnreadCount(res.count || 0);
    }
  });
};
